
#ifndef FIBER_ENV_COOPERATIVE_FILE_H_
#define FIBER_ENV_COOPERATIVE_FILE_H_

#include <stdio.h>

#include "./cooperative-fd.h"
#include "./file.h"

namespace fasmio { namespace fiber_env {

class CooperativeFile : public IFile
{
public:
    CooperativeFile();
    virtual ~CooperativeFile();

public:
    virtual bool Open(const char* path, const char* mode);
    virtual void Close();

    virtual long Write(const void* buff, unsigned long size);
    virtual long Read(void* buff, unsigned long size);

private:
    FILE* fp_;
    CooperativeFD fd_;
};

}}  // namespace fasmio::fiber_env

#endif  // FIBER_ENV_COOPERATIVE_FILE_H_

